package com.leankit.kanban.api;

import java.io.ByteArrayOutputStream;
import java.io.IOException;

import org.restlet.data.ChallengeScheme;
import org.restlet.resource.ClientResource;
import org.restlet.resource.ResourceException;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.leankit.kanban.api.client.library.transferobjects.BoardIdentifiers;

public class TestClass {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub

		ClientResource resource = new ClientResource("https://scottw512.leankitkanban.com//Kanban/Api/Board/24420158/GetBoardIdentifiers");

		// Send an authenticated request using the Basic authentication scheme.
		resource.setChallengeResponse(ChallengeScheme.HTTP_BASIC, "scottw512@gmail.com", "P@ssw0rd");
		
		// Send the request
		try {
			ByteArrayOutputStream byte1=new ByteArrayOutputStream();  
		    
			resource.get().write(byte1);
		    String contents=byte1.toString();  
			
		    System.out.println(contents);
		    Gson gson2 = new Gson();
		    JsonResult bb = gson2.fromJson(contents, new TypeToken<JsonResult<BoardIdentifiers>>() {}.getType());
		    
			System.out.println("");
			System.out.println(resource.getStatus());		

		} catch (ResourceException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
		// Should be 200
	}

}
